<!-- 为您推荐 -->
<template>
    <s-card>
        <template v-slot:title>为您推荐</template>
        <template v-slot:more>更多模板</template>
        <template v-slot:content>
            <div class="template-list" :gutter="16" type="flex" justify="start">
                <div
                    class="·"
                    @click="toTemp(item)"
                    v-for="item in templateList"
                    :key="item.id"
                >
                    <div class="item">
                        <div class="info">
                            <div
                                class="left"
                                :style="{
                                    backgroundColor: item?.logo?.color,
                                }"
                            >
                                <i
                                    class="iconfont"
                                    :class="item?.logo?.icon"
                                ></i>
                            </div>
                            <div class="right">
                                <div class="title">
                                    <span :title="item.name">
                                        {{ item.name }}
                                    </span>
                                </div>
                                <p class="text-overflow3">速搭云模板</p>
                            </div>
                        </div>
                        <div class="descript" :title="item.description">
                            <p class="text-overflow2">
                                {{ item.description || '暂无' }}
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </template>
    </s-card>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
import { TemplateVO } from '@/api/template/types.ts'
import SCard from '@/components/SCard/index.vue'

const templateList = ref<TemplateVO[]>([
    {
        id: '1',
        name: '业务辅助系统',
        status: '未发布',
        logo: {
            color: '#317FFF',
        },
        description: '为朝阳区政务服务局开发的考核评价系统',
    },
    {
        id: '1',
        name: '业务辅助系统',
        status: '未发布',
        logo: {
            color: '#317FFF',
        },
        description: '为朝阳区政务服务局开发的考核评价系统',
    },
    {
        id: '1',
        name: '业务辅助系统',
        status: '未发布',
        logo: {
            color: '#317FFF',
        },
        description: '为朝阳区政务服务局开发的考核评价系统',
    },
    {
        id: '1',
        name: '业务辅助系统',
        status: '未发布',
        logo: {
            color: '#317FFF',
        },
        description: '为朝阳区政务服务局开发的考核评价系统',
    },
    {
        id: '1',
        name: '业务辅助系统',
        status: '未发布',
        logo: {
            color: '#317FFF',
        },
        description: '为朝阳区政务服务局开发的考核评价系统',
    },
    {
        id: '1',
        name: '业务辅助系统',
        status: '未发布',
        logo: {
            color: '#317FFF',
        },
        description: '为朝阳区政务服务局开发的考核评价系统',
    },
])
const toTemp = (item: TemplateVO) => {
    console.log(item)
}
</script>

<style scoped lang="scss">
.template-list {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 120px;
    gap: 15px;
    .item {
        border: 1px solid var(--border-color-light);
        border-radius: 8px;
        padding: 10px 16px 20px 16px;
        cursor: pointer;
        .info {
            display: flex;
            align-items: center;
            padding: 10px 0px;
            .left {
                width: 35px;
                height: 35px;
                display: flex;
                justify-content: center;
                align-items: center;
                border-radius: 8px;
                i {
                    color: var(--color-white);
                    font-size: 18px;
                }
                img {
                    width: 18px;
                    height: 18px;
                }
            }
            .right {
                margin-left: 8px;
                .title {
                    height: 32px;
                    line-height: 32px;
                    max-width: 180px;
                    white-space: nowrap; /* 不换行 */
                    overflow: hidden; /* 隐藏超出部分 */
                    text-overflow: ellipsis; /* 显示省略号 */
                }
                p {
                    color: var(--text-color--gray);
                    font-size: 12px;
                }
            }
        }
        .descript {
            color: var(--text-color--gray);
            font-size: 12px;
        }
    }
    .item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 16px 0 var(--background-color-primary-hover);
    }
}
</style>
